<?php 
	require_once('inc_admin.php');
	connect();
	$id=$_GET['id'];
	$sql="select * from users where uid={$id}";
	$result=mysql_query($sql) or die('查询失败！'.mysql_error());
	$row=mysql_fetch_assoc($result);
	$uname=$row['uname'];
	$gender=$row['gender'];
	$birthdate=$row['birthdate'];
	$hobby=$row['hobby'];
	$degree=$row['degree'];
	$intro=$row['intro'];
	$pic=UserPhotoPath.$row['pic'];
// 将查询结果显示在表单中
		 ?>
		 <form method="post" action="userUpdate.php" enctype="multipart/form-data" class="form-horizontal" >
		 <!-- <table align="center" border="1" width=500> -->
		 <div class="container-fluid col-md-10">
		 		<h3 class="text-center">修改用户</h3>
		 	
		 		
		 	<input type="hidden" name="id" value=<?php echo $id; ?>>
		 	
		<div class="form-group">
		<label for="username" class="col-md-2 control-label">姓名</label>
		<div class="col-md-10">
		<input type="text" id="username" name="uname" class="form-control"
		    value=<?php echo $uname; ?>>
    </div>
	</div>
	
	<div class="form-group">
		<label for="" class="col-md-2 control-label">性别</label>
		<div class="col-md-10">
		<label class="radio-inline">
			<input type="radio"name="gender"value="0"<?php if (!$gender) echo'checked';  ?>>男</label>
			<label class="radio-inline">
			<input type="radio"name="gender"value="1" <?php if (!$gender) echo'checked';  ?>>女</label>
		</div>
	</div>
	
		 	
		
	<div class="form-group">
		<label for="" class="col-md-2 control-label">生日</label>
		<div class="col-md-10">
		<input type="date"name="birthdate" class="form-control"value=<?php  echo $birthdate;  ?>>
	</div>
	</div>
	<div class="form-group">
	<label class="col-md-2 control-label">爱好</label>
	<div class="col-md-10">
		<label class="checkbox-inline">
			<input type="checkbox"name="hobby[]"value="旅游"<?php if (!strstr($hobby,'旅游')) echo'checked';  ?>>旅游</label>
		<label class="checkbox-inline">
			<input type="checkbox"name="hobby[]"value="登山"<?php if (!strstr($hobby,'登山')) echo'checked';  ?>>登山</label>
		<label class="checkbox-inline">
			<input type="checkbox"name="hobby[]"value="健身"<?php if (!strstr($hobby,'健身')) echo'checked';  ?>>健身</label>
		<label class="checkbox-inline">
			<input type="checkbox"name="hobby[]"value="上网"<?php if (!strstr($hobby,'上网')) echo'checked';  ?>>上网</label>
		<label class="checkbox-inline">
			<input type="checkbox"name="hobby[]"value="游泳"<?php if (!strstr($hobby,'游泳')) echo'checked';  ?>>游泳</label>
	</div>		
	</div>
	<div class="form-group">
	<label class="col-md-2 control-label">学历</label>
	<div class="col-md-10">
	<select  class="form-control"  name="degree">
		<option value="0">请选择</option>
			<option value="1" <?php if ($degree=='1') echo 'selected' ?>>高中</option>
			<option value="2"<?php if ($degree=='2') echo 'selected' ?>>大学</option>
			<option value="3"<?php if ($degree=='3') echo 'selected' ?>>研究生</option>
			<option value="4"<?php if ($degree=='4') echo 'selected' ?>>博士生</option>
	</select>
	</div>
	</div>
	<div class="form-group">
	<label  class="col-md-2 control-label">自我介绍</label>
	<div class="col-md-10">
		<textarea  name="intro"class="form-control" rows="5" cols="40"   name="intro"><?php echo $intro ?></textarea>
	</div>
	</div>
	<div class="form-group">
	<label  class="col-md-2 control-label">头像</label>
	<div class="col-md-10">
		<input type="file" name="pic" >
		原头像:<img src="../images/<?php echo $row["pic"]; ?>"width="80px" height="80px" class="img-circle">
	</div>
	</div>
	<div class="form-group">
	<div class="col-sm-offset-2 col-sm-10">
		<input type="submit" class="btn btn-default" value="修改">
		<input type="reset" class="btn btn-default" value="重置">
	</div>
	</div>
	</form>
	</div>